/*
 * Copyright 2008-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.app.jQuery.global.util;

import java.security.SecureRandom;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
 * TestSecureRandom
 *
 * @author 李长伟
 * @version 1.0 创建时间  2015年6月23日 上午10:39:13
 *
 */
public class TestRandom {

    private static SecureRandom secureRandom = new SecureRandom();
    
    public static void main(String[] args) throws Exception {
        Random random = new Random();
        //性能较低，安全性低，线程安全。。。 放弃使用了
        System.out.println(Math.abs(random.nextInt(10)));
        //性能还行，安全性高，线程安全。。。性价比较高吧
        System.out.println(Math.abs(secureRandom.nextInt(10)));
        //性能最高，安全性低，线程安全。。。
        System.out.println(Math.abs(ThreadLocalRandom.current().nextInt(10)));
    }
    
}
